<?php
$onePerPage = array_key_exists('onePerPage', $this->request) && 'yes' == $this->request['onePerPage'];
$currentUnit = isset($this->request['unit']) ? $this->request['unit'] : $this->user->getStaffLibrary();
?>
<script language='JavaScript1.2'>
	var jsFunctions = new basicAJAX();				  
	function markAsPulled(request_ids, notice)
	{
		var status = <?php print(Rd_Request_Status::getOptionByToken('SEARCH STACKS')->getId());?>;
		var u   = 'AJAX_functions.php?f=updateRequestStatus';
		var qs;
		var url;
						  
	  	for(var i=0;i<request_ids.length;i++)				  		
	  	{				  			
	  		qs  = 'request_id=' + request_ids[i] + '&status=' + status;
	  		url = u + '&rf=' + jsFunctions.base64_encode(qs);
			
			ajax_transport(url, notice);				  			
		}
	}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
		<td align="left">Request List</td>
	</tr>
	<tr>
		<td align="left"> <?php print(date('g:i A D m-d-Y')); ?></td>
	</tr>
	<tr class="noPrint">
		<td align="right"><img src="public/images/spacer.gif" width="1" height="15">[ <a href="javascript:window.close();">Close Window</a> ]</td>
	</tr>	

	<tr class="noPrint">
		<td align="right"><input type="button" value="Print" onClick="window.print();"></td>
	</tr>
	<tr class="noPrint">
		<td align="right">
			<div id="marked_indicator" style='display: inline;'><input type="button" value="Mark All As PULLED" onClick="markAsPulled([<?php print($this->requestList->id_list()); ?>], 'marked_indicator');"></div>
			<div id="paginationToggle" style='display: inline;'>
				<form action="index.php?sort=<? print(array_key_exists('sort', $this->request) ? $this->request['sort'] : ''); ?>" method="POST">
					<input type="hidden" name="cmd" value="printRequest">
			        <!-- <input type="hidden" name="sort" value="<?php print(array_key_exists('sort', $this->request) ? $this->request['sort'] : ''); ?>"> -->
			        <input type="hidden" name="no_table">
			        <input type="hidden" name="request_id">
					<span>This view will print <?php print( $onePerPage ? 'One Item Per Page' : 'Multiple Items Per Page'); ?> </span><input type="submit" name="submit" value="<?php print( $onePerPage ? 'Switch to Multiple Per Page Layout' : 'Switch to One Per Page Layout' ); ?>"/> 
					<?php if(!$onePerPage) { ?>
					<input type="hidden" name="onePerPage" value="yes"/>
					<?php } ?>
					<?php foreach($this->request['selectedRequest'] as $requestId) { ?>
					<input type="hidden" name="selectedRequest[]" value="<?php print($requestId); ?>"/>
						<?php if (array_key_exists($requestId . '_status', $this->request)) { ?>
						<input type="hidden" name="<?php print($requestId . '_status'); ?>" value="<?php print($this->request[$requestId . '_status']); ?>"/>
						<?php } ?>
					<?php } ?>
				</form>
			</div>
		</td>
	</tr>		
<?php 		
if (!is_null($this->msg) && '' != trim($this->msg)) {
?>
	<tr><td width="100%" class="failedText" align="center"><?php print($this->msg); ?><br></td></tr>
<?php 
}
?>
</table>
<!-- 
</td>
</tr>
</table>	 -->
<?php 
if (count($this->requestList) > 0) {
			$this->getDisplayer()->displayRequestList($this->requestList, $this->request, $this->user, $this->currentUnit, 'true');
} else {
?>
	<p style="text-align: center">No requests selected for printing.</p>
<?php } ?>
